package org.hospital.pojo;

import java.util.Date;
import java.util.HashSet;
import java.util.Set;

import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;

import org.hibernate.annotations.Cascade;

/**
 * TFirVisit entity. @author MyEclipse Persistence Tools
 */
@Entity
@Table(name="t_fir_visit")
public class TFirVisit implements java.io.Serializable {

	// Fields

	private Integer firId;
	private Date firVisitDate;
	private String complaint;
	private String presentIllness;
	private String historyIllness;
	private String obsterical;
	private String specialInspect;
	private String labInspect;
	private String aidInspect;
	private String diagnosis;
	private String cure;
	private TPatient patient;
	private Set<TFirPhoto> firPhoto = new HashSet<TFirPhoto>();
	private Set<TFurVisit> furVisit = new HashSet<TFurVisit>();

	

	// Constructors
	
	@OneToMany(mappedBy="firVisit", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
	@Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
	public Set<TFurVisit> getFurVisit() {
		return furVisit;
	}

	public void setFurVisit(Set<TFurVisit> furVisit) {
		this.furVisit = furVisit;
	}
	
	public void addFurVisit(TFurVisit furVisit) {   
        if (!this.furVisit.contains(furVisit)) {   
            this.furVisit.add(furVisit);   
            furVisit.setFirVisit(this);   
        }   
    }   
  
    public void removeFurVisit(TFurVisit furVisit) {   
    	furVisit.setFirVisit(null);   
        this.furVisit.remove(furVisit);   
    }
	
	@OneToMany(mappedBy="firVisit", cascade = CascadeType.ALL, fetch = FetchType.EAGER)
	@Cascade(org.hibernate.annotations.CascadeType.DELETE_ORPHAN)
	public Set<TFirPhoto> getFirPhoto() {
		return firPhoto;
	}

	public void setFirPhoto(Set<TFirPhoto> firPhoto) {
		this.firPhoto = firPhoto;
	}
	
	public void addFirPhoto(TFirPhoto firPhoto) {   
        if (!this.firPhoto.contains(firPhoto)) {   
            this.firPhoto.add(firPhoto);   
            firPhoto.setFirVisit(this);   
        }   
    }   
  
    public void removeFirPhoto(TFirPhoto firPhoto) {   
    	firPhoto.setFirVisit(null);   
        this.firPhoto.remove(firPhoto);   
    }

	@ManyToOne(cascade={CascadeType.REFRESH,CascadeType.REMOVE},optional=false) 
	@JoinColumn(name="PATIENT_ID")
	public TPatient getPatient() {
		return patient;
	}

	public void setPatient(TPatient patient) {
		this.patient = patient;
	}

	/** default constructor */
	public TFirVisit() {
	}

	/** full constructor */
	public TFirVisit(Date firVisitDate, String complaint,
			String presentIllness, String historyIllness, String obsterical,
			String specialInspect, String labInspect, String aidInspect,
			String diagnosis, String cure) {
		this.firVisitDate = firVisitDate;
		this.complaint = complaint;
		this.presentIllness = presentIllness;
		this.historyIllness = historyIllness;
		this.obsterical = obsterical;
		this.specialInspect = specialInspect;
		this.labInspect = labInspect;
		this.aidInspect = aidInspect;
		this.diagnosis = diagnosis;
		this.cure = cure;
	}

	// Property accessors
	@Id
	@Column(name="FIR_ID",insertable=true,nullable=false,updatable=true)
    @GeneratedValue(strategy=GenerationType.AUTO)
	public Integer getFirId() {
		return this.firId;
	}

	public void setFirId(Integer firId) {
		this.firId = firId;
	}


	@Column(name="FIR_VISIT_DATE")
	public Date getFirVisitData() {
		return this.firVisitDate;
	}

	public void setFirVisitData(Date firVisitDate) {
		this.firVisitDate = firVisitDate;
	}

	public String getComplaint() {
		return this.complaint;
	}

	public void setComplaint(String complaint) {
		this.complaint = complaint;
	}

	@Column(name="PRESENT_ILLNESS")
	public String getPresentIllness() {
		return this.presentIllness;
	}

	public void setPresentIllness(String presentIllness) {
		this.presentIllness = presentIllness;
	}
	
	@Column(name="HISTORY_ILLNESS")
	public String getHistoryIllness() {
		return this.historyIllness;
	}

	public void setHistoryIllness(String historyIllness) {
		this.historyIllness = historyIllness;
	}

	public String getObsterical() {
		return this.obsterical;
	}

	public void setObsterical(String obsterical) {
		this.obsterical = obsterical;
	}
	
	@Column(name="SPECIAL_INSPECT")
	public String getSpecialInspect() {
		return this.specialInspect;
	}

	public void setSpecialInspect(String specialInspect) {
		this.specialInspect = specialInspect;
	}
	
	@Column(name="LAB_INSPECT")
	public String getLabInspect() {
		return this.labInspect;
	}

	public void setLabInspect(String labInspect) {
		this.labInspect = labInspect;
	}
	
	@Column(name="AID_INSPECT")
	public String getAidInspect() {
		return this.aidInspect;
	}

	public void setAidInspect(String aidInspect) {
		this.aidInspect = aidInspect;
	}

	public String getDiagnosis() {
		return this.diagnosis;
	}

	public void setDiagnosis(String diagnosis) {
		this.diagnosis = diagnosis;
	}

	public String getCure() {
		return this.cure;
	}

	public void setCure(String cure) {
		this.cure = cure;
	}

}